import sqlite3

class DataManagement:
    def __init__(self):
        self.conn = sqlite3.connect('grab_tickets_config.db')
        self.cursor = self.conn.cursor()
        self.create_table()

    def create_table(self):
        self.cursor.execute('''
            CREATE TABLE IF NOT EXISTS grab_tickets_config (
                id INTEGER PRIMARY KEY AUTOINCREMENT,
                config_name TEXT,
                config_value TEXT
            )
        ''')
        self.conn.commit()

    def local_storage(self, config_name, config_value):
        """SQLite存储抢票配置"""
        self.cursor.execute('''
            INSERT INTO grab_tickets_config (config_name, config_value)
            VALUES (?, ?)
        ''', (config_name, config_value))
        self.conn.commit()

    def cloud_sync(self):
        """可选阿里云OSS备份数据"""
        pass